package com.dycong.common.strategy;

import lombok.extern.slf4j.Slf4j;


/**
 * 抽奖逻辑抽象类
 *
 * @author stxc
 * @CreateDate: 2019/3/29
 * @Version: 1.0
 */
@Slf4j
public abstract class AbstractDrawStrategyService implements StrategyService {


    @Override
    public DoDrawResultBO doDraw(String suid, Long userId, String phone, Object... extParams) throws Exception {
        // 抽奖前置逻辑
        DoDrawResultBO doDrawResultBO = preHandle(suid, userId, phone, extParams);

        doRule(doDrawResultBO);

        doDrawResultBO = postHandle(suid, userId, phone, extParams);


        return doDrawResultBO;
    }


    /**
     * 执行rule策略
     *
     * @param doDrawResultBO
     * @return
     */
    abstract DoRuleResultBO doRule(DoDrawResultBO doDrawResultBO);

    /**
     * 抽奖前置处理
     *
     * @return
     */
    abstract DoDrawResultBO preHandle(String suid, Long userId, String phone, Object... extParams);

    /**
     * 抽奖后置处理
     */
    abstract DoDrawResultBO postHandle(String suid, Long userId, String phone, Object... extParams);
}
